public class MyNode {
    private class Node {
        public String data;
        public Node next;

        Node(String data,Node next){
            this.data = data;
            this.next = next;
        }
    }
    Node head;
    int size;

    public void add(String data) {
        for (Node cur=head.next;cur!=null;cur=cur.next){
            cur.next = new Node(data,cur.next);
        }
        size ++;
    }

    @Override
    public String toString(){
        StringBuilder res = new StringBuilder();
        for (MyNode.Node cur = head.next; cur != null; cur= cur.next)
            res.append(cur+"->");
        res.append("NULL");

        return  res.toString();
    }
}
